package com.wzz.second.config;

import org.apache.activemq.command.ActiveMQQueue;
import org.apache.activemq.command.ActiveMQTopic;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.jms.Queue;
import javax.jms.Topic;

@Configuration
public class BeanConfig {

    @Value("${myQueueName}")
    private String name;

    @Value("${myTopicName}")
    private String topicName;
    //定义存放消息的队列
    @Bean
    public Queue queue(){
        return new ActiveMQQueue(name);
    }

    @Bean
    public Topic topic(){
        return new ActiveMQTopic(topicName);
    }
}
